package com.zbkj.common.response;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)   //比较两个对象时需要考虑父类（基类，超类）中的成员，使用@EqualsAndHashCode(callSuper=true)，才能正确比较
public class User extends TestHashCode {
    private String userName;
    private String password;
    private static final long serialVersionUID=1L;
    public User(Integer id, Integer IdentityNo, String userName, String password) {
        super(id, IdentityNo);
        this.userName = userName;
        this.password = password;
    }

    public static void main(String[] args) {
        User user1 = new User(1, 1427, "abc", "123456");
        User user2 = new User(2, 2345, "abc", "123456");
        System.out.println(user1.equals(user2));
        System.out.println(user1.hashCode() == user2.hashCode());
        System.out.println("user1" + user1.hashCode());
        System.out.println("user2" + user2.hashCode());
    }


}
